<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">

    <title>首页</title>

    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/signin.css" rel="stylesheet">

    <style>
        table td {
            padding-left: 20px;
        }
        table tr {
            margin-top: 10px;
        }
    </style>
</head>

<body>
    <div>
        <a href="/">首页</a>
        <a href="javascript:void(0)" onclick="signout_fn()" >退出</a>
        <h1>hello world!</h1>
        <p><a href="/user/list/page">用户列表</a></p>
        <p>-------------------------------------------------------------------------------------------------------------------</p>
        <table>
            <thead>
            <tr>
                <td>订单状态</td>
                <td>操作</td>
            </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        <span>已完成</span>
                        <span style="display: none">00000000000001</span>
                        <span style="display: none">1172</span>
                        <span style="display: none">1173</span>
                    </td>
                    <td><a href="" target="_blank">物流运输</a></td>
                </tr>
                <tr>
                    <td>
                        <span>已完成</span>
                        <span style="display: none">00000000000002</span>
                        <span style="display: none">1172</span>
                        <span style="display: none">1173</span>
                    </td>
                    <td><a href="" target="_blank">物流运输</a></td>
                </tr>
                <tr>
                    <td>
                        <span>已完成</span>
                        <span style="display: none">00000000000003</span>
                        <span style="display: none">1172</span>
                        <span style="display: none">1173</span>
                    </td>
                    <td><a href="" target="_blank">物流运输</a></td>
                </tr>
                <tr>
                    <td>
                        <span>已完成</span>
                        <span style="display: none">00000000000004</span>
                        <span style="display: none">1172</span>
                        <span style="display: none">1173</span>
                    </td>
                    <td><a href="" target="_blank">物流运输</a></td>
                </tr>
                <tr>
                    <td>
                        <span>已完成</span>
                        <span style="display: none">00000000000005</span>
                        <span style="display: none">1172</span>
                        <span style="display: none">1173</span>
                    </td>
                    <td><a href="" target="_blank">物流运输</a></td>
                </tr>
                <tr>
                    <td>
                        <span>已完成</span>
                        <span style="display: none">00000000000006</span>
                        <span style="display: none">1172</span>
                        <span style="display: none">1173</span>
                    </td>
                    <td><a href="" target="_blank">物流运输</a></td>
                </tr>
                <tr>
                    <td>
                        <span>已完成</span>
                        <span style="display: none">00000000000007</span>
                        <span style="display: none">1172</span>
                        <span style="display: none">1173</span>
                    </td>
                    <td><a href="" target="_blank">物流运输</a></td>
                </tr>
                <tr>
                    <td>
                        <span>已完成</span>
                        <span style="display: none">00000000000008</span>
                        <span style="display: none">1172</span>
                        <span style="display: none">1173</span>
                    </td>
                    <td><a href="" target="_blank">物流运输</a></td>
                </tr>
            </tbody>
        </table>
    </div>
    <script type="text/javascript" src="/js/jquery-1.12.4.js"></script>
    <script type="text/javascript">
        $(function () {
            $.ajax({
//                url: 'http://10.82.12.98:8062/zlgxwl/v1/crossplatform/order/state',
                url: 'http://10.82.13.116:8080/zlgxwl/v1/crossplatform/order/state',
                type: 'POST',
                contentType: "application/json",
                xhrFields: {
                    withCredentials: true
                },
                crossDomain: true,
                data: JSON.stringify({
                        "platform": "cenpur",
                        "orders": [
                                {"objectId": "00000000000001"},
                                {"objectId": "00000000000002"},
                                {"objectId": "00000000000003"}
                        ],
                        "token": "b53370d86a8b4427a82d296040e84e15"
                    }),
                success: function (res) {
                    res = JSON.parse(res);
                    console.info(res)
                }
            });




            var href = "https://wl.zsteel.cc/zlgxwl";
//            var href = "http://localhost:8080/zlgxwl";
            var token = "27b48ffedadf436297d2a34c76b38702";
//            var params = {
//                "platform": "trade",
//                "orders": [],
//                "token": "5ddb551f21904496a923752b6cbf88e5"
//            };
            $.each($('table tbody tr'), function (i, o) {
                $(o).find('a').attr('href', href + '/htm/sender/transport.html?platform=trade&sourceSupplier=供应商&sourceKinds=钢材&sourceBrand=一大捆钢材&sourceGoodsWorth=1000000&sourceWeight=600000&sourceUnit=1&sourceDescribe=买买买买买买买买买买买买&sendAddressAreaId=1172&sendAddress=天津港&sendAddressUnit=天津港大码头&sendAddressMan=张三&sendAddressMobile=13366666666&sendAddressStore=天津钢铁总部仓库&receiveAddressAreaId=1173&receiveAddress=大学路105号&receiveAddressUnit=北京钢铁总部&receiveAddressMan=李四&receiveAddressMobile=13500000000&' +
                        'sourceType=1&objectId=' + $(o).find("span:eq(1)").text() + '&token=' + token);

//                params.orders.push({
//                    "objectId": $(o).find("span:eq(1)").text(),
//                    "sendAddressAreaId": $(o).find("span:eq(2)").text(),
//                    "receiveAddressAreaId": $(o).find("span:eq(3)").text()
//                })
            });
//
//            $.ajax({
//                url: 'http://127.0.0.1:8080/zlgxwl/v1/crossplatform/order/state',
//                type: 'POST',
//                contentType: "application/json",
//                xhrFields: {
//                    withCredentials: true
//                },
//                crossDomain: true,
//                data: JSON.stringify(params),
//                success: function (res) {
//                    res = JSON.parse(res);
//                    if(res.code == 10000){
//                        res.data.forEach(function (oo, i) {
//                            $.each($('table tbody tr'), function (i, o) {
//                                if (oo.objectId == $(o).find("span:eq(1)").text()) {
//                                    var href = $(o).find('a').attr('href');
//                                    if (oo.state == 0){
//                                        $(o).find('a').attr('href', href + '/html/sender/logisticsList?platform=trade&sourceSupplier=供应商&sourceKinds=1&sourceBrand=一大捆钢材&sourceGoodsWorth=1000000&sourceWeight=600000&sourceUnit=1&sourceDescribe=买买买买买买买买买买买买&sendAddressAreaId=1172&sendAddress=天津港&sendAddressUnit=天津港大码头&sendAddressMan=张三&sendAddressMobile=13366666666&sendAddressStore=天津钢铁总部仓库&receiveAddressAreaId=1173&receiveAddress=大学路105号&receiveAddressUnit=北京钢铁总部&receiveAddressMan=李四&receiveAddressMobile=13500000000&objectId=' + oo.objectId);
//                                    } else {
//                                        $(o).find('a').attr('href', href + '/html/sender/detail?sourceType=1&sourceWeight=120000&objectId=' + oo.objectId);
//                                    }
//                                }
//                            })
//                        })
//                    }
//                }
//            });
        });

        function signout_fn() {
            $.ajax({
                url: '/authentication/signout',
                type: 'GET',
                success: function (data) {
                    if (data.code == 1000) {
                        alert("注销成功");
                        window.location.href = '/';
                    }
                }
            });
        }




    </script>

</body>
</html>
